-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unsubscribe functionality at backend (#236) #237
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to Django India! 🎉🇮🇳
We're so happy to see you contribute. Your efforts mean a lot to us and we're excited to have you on this journey.
Before we proceed, please take a moment to review our contribution guide. It's packed with all the information you need to make your contribution seamless.
If you're fixing an issue from the Django India issue tracker, remember to get it assigned to you before you acutally start working on it.
If you ever need help or just want to chat, the Django India discord server is always open. We're here for you!
And while you're here, don't forget to ⭐ star our repo to show your support! It helps the community grow.
Thank you for being a part of Django India. Together, let's make an amazing community! 🚀
Looks good 👍 Can you please have a look? @prakkhar03 |
Ya Sure I'll look into it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @prakkhar03 ! Left few minor comments, Rest looks good.
There might be some changes depending upon #235 , so lets wait for that to get merged.
class UnsubscribeAPIView(generics.GenericAPIView): | ||
def delete(self, request, token=None): | ||
try: | ||
unsubscribe_token = token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prakkhar03, we should avoid using try-except unless there’s code where we’re uncertain about how it might fail. Also you can use token directly to check condition no need to store at another variable
Need to rebase this to main. |
Co-authored-by: Bhuvnesh <[email protected]>
Co-authored-by: Bhuvnesh <[email protected]>
Co-authored-by: Bhuvnesh <[email protected]>
let's merge this soon. no point on extending. |
@ankanchanda I will make a few changes today and commit them. Once done, the branch will be ready for merging |
Closes #236
Summary
Added unsubscribe functionality to the backend to allow users to opt out of subscription services.
Changes
Implemented UnsubscribeAPIView to handle user unsubscribe requests.
Added a new endpoint for unsubscribe in the urls.py.
Updated the Subscriber model and serializer for supporting unsubscribe.
Improved responses and error handling for both subscription and unsubscribe flows.
Type of change
Flags
Ensure the unsubscribe logic doesn't conflict with existing subscription logic.
Review if email validation works correctly during unsubscribe.
Demo
How has this been tested?
Endpoint for unsubscribe: /api/unsubscribe/
{
"email": "[email protected]"
}
Response
{
"message": "You have successfully unsubscribed. We're sad to see you go!"
}
###Author Checklist
main
fromfork: djangoindia.orgtest
How Tested
Manually tested the unsubscribe API endpoint with valid and invalid email addresses.